package main

import "fmt"

//168ms 68%, 8.1MB 36%
type CQueue struct {
	inStack, outStack []int
}

//构造队列
func Constructor() CQueue {
	return CQueue{}
}

func (q *CQueue) AppendTail(value int) {
	q.inStack = append(q.inStack, value)

}

func (q *CQueue) DeleteHead() int {
	if len(q.outStack) == 0 {
		if len(q.inStack) == 0 {
			return -1
		}
		q.outStack = append(q.outStack, q.inStack...)
		q.inStack = []int{}

	}
	val := q.outStack[0]
	q.outStack = q.outStack[1:]
	return val
}

func main() {
	q := Constructor()
	q.AppendTail(3)
	fmt.Println(q.DeleteHead())
}
